import java.io.IOException;
import java.text.DecimalFormat;
import java.util.HashMap;
import java.util.StringTokenizer;

public class Main{
	public static void main(String[] args) throws IOException {
		HashMap<String, Double> conv = new HashMap<String, Double>() {
			{
				put("kg", 2.2046);
				put("lb", 0.4536);
				put("l", 0.2642);
				put("g", 3.7854);

			}
		};
		HashMap<String, String> c2 = new HashMap<String, String>() {
			{
				put("kg", "lb");
				put("lb", "kg");
				put("l", "g");
				put("g", "l");

			}
		};

		java.io.BufferedReader r = new java.io.BufferedReader(
				new java.io.InputStreamReader(System.in));

		int number = Integer.parseInt(r.readLine());
		for (int i = 0; i < number; i++) {
			String s = r.readLine();
			StringTokenizer tokenizer = new StringTokenizer(s);

			double d = Double.parseDouble(tokenizer.nextToken());
			String unit = tokenizer.nextToken();
			String result;
			DecimalFormat df = new DecimalFormat("#.0000");
			result = df.format(d * conv.get(unit));
			if (result.startsWith(".")) {
				result = 0 + result;
			}
			System.out.println((i + 1) + " " + result + " " + c2.get(unit));
		}
	}
}